package logic

import (
	"context"
	"user/pkg"

	"user/internal/svc"
	"user/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type RealLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRealLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RealLogic {
	return &RealLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RealLogic) Real(req *types.RealRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	if !pkg.RealPeoPle(req.RealName, req.RealNum) {
		return &types.Response{
			Code:    500,
			Message: "实名认证失败",
			Data:    nil,
		}, nil
	}

	return &types.Response{
		Code:    200,
		Message: "实名认证成功",
		Data:    nil,
	}, nil
}
